﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace ClassLibraryMessageDispacher
{
    public class ClassMssageTypeGather
    {
    }
    /// <summary>
    /// 路径
    /// </summary>
    public enum MessagePackagePath
    {
        None=0,
        UICom,
        NetMiddleDeviceCom,
        DBCom,
         
        MAXID,
    }
    /// <summary>
    /// 产生目标意义
    /// </summary>
    public enum ProductType
    {
        /// <summary>
        /// 请求数据
        /// </summary>
        request=0,
        /// <summary>
        /// 反回数据
        /// </summary>
        returned,
        /// <summary>
        /// 上报数据
        /// </summary>
        updatapush,
         /// <summary>
         /// 通知事件
         /// </summary>
        notifyevent
    }
    /// <summary>
    /// 
    /// </summary>
    public struct SoureDetailInfo
    {
        public MessagePackagePath sourepath;
        public string soureIP;
        public string DB;
    }
    /// <summary>
    /// 
    /// </summary>
    public struct DestDetailInfo
    {
        public MessagePackagePath destpath;
        public string destIP;
        public string DB;
    }

    public class messagebase
    {
        public string name { get; set; }
    }
    /// <summary>
    /// 消息包
    /// </summary>
    public class MessagePackage:  messagebase
    {
     /// <summary>
     /// 
     /// </summary>
        public MessagePackage() { }


        public void setMembers(
            ProductType m_proType,
            byte m_direct,
            ushort m_squence,
            bool m_isNeedReback,
            MessagePackagePath m_soure,
            MessagePackagePath m_dest,
            SoureDetailInfo m_sdinfo,
            DestDetailInfo m_ddinfo,
            string m_notify,
            ArraySegment<byte> m_bytesArry
            )
        {

            this.direct = m_direct;
            this.squence = m_squence;
            this.proType = m_proType;
            this.isNeedReback = m_isNeedReback;
            this.soure = m_soure;
            this.dest = m_dest;
            this.sdinfo = m_sdinfo;
            this.ddinfo = m_ddinfo;
            this.notifyStr = m_notify;
            this.bytesArry = m_bytesArry;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="m_proType"></param>
        /// <param name="m_direct"></param>
        /// <param name="m_squence"></param>
        /// <param name="m_isNeedReback"></param>
        /// <param name="m_soure"></param>
        /// <param name="m_dest"></param>
        /// <param name="m_sdinfo"></param>
        /// <param name="m_ddinfo"></param>
        /// <param name="m_notify"></param>
        /// <param name="m_bytesArry"></param>
        public MessagePackage( 
            ProductType m_proType,
            byte m_direct,
            ushort m_squence,          
            bool m_isNeedReback,
            MessagePackagePath m_soure,
            MessagePackagePath m_dest,
            SoureDetailInfo m_sdinfo,
            DestDetailInfo m_ddinfo,
            string m_notify ,
            ArraySegment<byte> m_bytesArry          
            )
        {
            this.direct = m_direct;
            this.squence = m_squence;
            this.proType = m_proType;
            this.isNeedReback = m_isNeedReback;
            this.soure = m_soure;
            this.dest = m_dest;
            this.sdinfo = m_sdinfo;
            this.ddinfo = m_ddinfo;
            this.notifyStr = m_notify;
            this.bytesArry = m_bytesArry;
        }
        /// <summary>
        /// 方向
        /// </summary>
        public byte direct;
        /// <summary>
        /// 消息号
        /// </summary>
        public ushort squence;
        /// <summary>
        /// 产生目标
        /// </summary>
        public ProductType proType;
        /// <summary>
        /// 是否有数据返回需求
        /// </summary>
        public bool isNeedReback;
        /// <summary>
        /// 来源
        /// </summary>
        public MessagePackagePath soure;
        /// <summary>
        /// 目标
        /// </summary>
        public MessagePackagePath dest;
        /// <summary>
        /// 发送目标详细数据参数
        /// </summary>
        public SoureDetailInfo sdinfo;
        /// <summary>
        /// 接受目标详细参数
        /// </summary>
        public DestDetailInfo ddinfo;
        /// <summary>
        /// 通知短文
        /// </summary>
        public string notifyStr;
        /// <summary>
        /// 包含的数据
        /// </summary>
        public ArraySegment<byte> bytesArry;
        
    }

       
}
